package com.aids_malaria.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;

import com.aids_malaria.http.response.PremedicalTreatmentPack;

import java.util.List;

@Dao
public interface PremedicalTreatmentPackDao {
    @Query("delete from premedicalTreatmentPack")
    int deleteAll();

    @Delete
    int delete(PremedicalTreatmentPack premedicalTreatmentPack);

    @Query("SELECT * FROM premedicalTreatmentPack")
    List<PremedicalTreatmentPack> getAll();

    @Query("SELECT * FROM premedicalTreatmentPack WHERE createOrUpdate =:isCreateUpdate")
    List<PremedicalTreatmentPack> getAllByCreateUpdate(boolean isCreateUpdate);

    @Query("SELECT * FROM premedicalTreatmentPack WHERE identity_code IN (:identity_code)")
    List<PremedicalTreatmentPack> findById(String identity_code);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<PremedicalTreatmentPack> users);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(PremedicalTreatmentPack user);
}